Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More-Granular Bailing #836

Closed
wants to merge 6 commits into from
Closed

Conversation

aearly
Copy link
Contributor

@aearly aearly commented May 6, 2013

This change gives you more control over the bail option for a suite. Currently, setting this.bail() in a describe() or --bail through the CLI will cause mocha to stop executing all further tests, even tests in sibling or parent suites. This change allows you to turn bail on and off in suites and scope the bailing to only that suite and its descendant suites. Also, if a child suite turns off bailing, it will be run even if its parent bails. See the new bail2.js spec file for concrete examples.

I'm not sure if this is a merge-worthy feature, but it helps one of my use-cases in Mocha, where I want only certain suites to bail, and the bailing to be scoped.

@aearly
Copy link
Contributor Author

aearly commented May 6, 2013

This also encompasses my previous pull request, #835 .

@tj
Copy link
Contributor

tj commented May 6, 2013

I don't mind it but I do think the use-case is pretty narrow, probably not worth adding to core, especially since most good modules are quite small bailing from the entire thing is generally not a big deal

@aearly
Copy link
Contributor Author

aearly commented May 6, 2013

My use cases:

I have suites where if one test fails, the rest of the tests in the suite are bound to fail. These are rather slow integration tests that use remote APIs. However, I still care about subsequent suites. It's nice to get a high level picture as fast as possible without grepping to suites that wont fail. Also, some of the subsequent tests in the suite might only fail due to the bad state left by the failing test.

I also use mocha to do cross-browser functional testing, with a suite for each browser. If something fails in IE, more things are likely to fail in IE, but I still want to run the Chrome tests. Very useful when hooking up to CI or running full regressions, as well.

@bermi
Copy link

bermi commented May 8, 2013

+1 I'd also like to see this made available on the core

@aearly aearly mentioned this pull request May 16, 2013
@travisjeffery
Copy link
Contributor

-1 as well. we also have #1043 in now which could help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants